<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改知识课堂类别')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-ncKnowledgeClassType-edit" th:object="${ncKnowledgeClassType}">
        <input id="kctypeId" name="kctypeId" th:field="*{kctypeId}" type="hidden">
        <input id="treeId" name="parentId" th:field="*{parentId}" type="hidden"/>
        <div class="form-group">
            <label class="col-sm-3 control-label ">上级知识课堂分类：</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <input class="form-control" required id="treeName" onclick="selectKCTypeTree()" readonly="true" th:field="*{parentName}"
                           type="text">
                    <span class="input-group-addon"><i class="fa fa-search"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">知识课堂名称：</label>
            <div class="col-sm-8">
                <input class="form-control" required id="kcTypeName" name="kcTypeName" th:field="*{kcTypeName}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">知识课堂编码：</label>
            <div class="col-sm-8">
                <input class="form-control" required id="code" name="code" th:field="*{code}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">显示顺序：</label>
            <div class="col-sm-8">
                <input class="form-control" required id="orderNum" name="orderNum" th:field="*{orderNum}" type="number">
            </div>
        </div>


    </form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
    var prefix = ctx + "system/ncKnowledgeClassType";
    $("#form-ncKnowledgeClassType-edit").validate({
        rules: {
            xxxx: {
                required: true,
            },
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-ncKnowledgeClassType-edit').serialize());
        }
    }

    function selectKCTypeTree() {
		var caiId = $("#treeId").val();

		if(caiId > 0) {
			var options = {
				title: '知识课堂选择',
				width: "380",
				url: prefix + "/selectKCTypeTree/" + $("#treeId").val(),
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		} else {
			$.modal.alertError("父药品不能选择");
		}
    }

    function doSubmit(index, layero) {
        var body = layer.getChildFrame('body', index);
        $("#treeId").val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        layer.close(index);
    }
</script>
</body>
</html>
